-
Couldn't load subscription status.
- Fork 0
Docs/orpc wrap trpc #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs/orpc wrap trpc #114
Conversation
Upgrade to ESM module system to enable use of zod 3.25.0 and @orpc packages (required for OpenAPI generation from tRPC). Both packages are ESM-only and cannot be imported in CommonJS projects. Changes: - Add type: module to package.json and configure ESNext in tsconfig - Install and configure @swc-node/register for ESM runtime with decorator support - Replace __dirname with ESM-compatible import.meta.url - Add explicit enum types to TypeORM columns for proper metadata emission
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates ORPC (OpenAPI Router for Procedure Calls) to wrap the existing tRPC implementation, enabling automatic OpenAPI documentation generation for the ESC Project Tracker API. The changes upgrade tRPC from v10 to v11 and add API documentation endpoints accessible via Scalar UI.
Key Changes:
- Upgraded tRPC from v10.45.2 to v11.7.0 across both web and api packages
- Integrated ORPC libraries (@orpc/trpc, @orpc/openapi, @orpc/zod) to generate OpenAPI specifications
- Added metadata tags and summaries to all tRPC procedures for API documentation
- Configured ESM module system for the API package
Reviewed Changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/package.json | Updated tRPC client dependencies to v11.7.0 and reordered @repo/shared |
| apps/api/package.json | Added ORPC packages, upgraded tRPC to v11.7.0, configured ESM support, and updated dev scripts |
| apps/api/tsconfig.json | Changed module system from NodeNext to ESNext with bundler resolution |
| apps/api/src/app.module.ts | Added ESM-compatible __dirname polyfill using fileURLToPath |
| apps/api/src/trpc/trpc.service.ts | Added ORPCMeta type to tRPC initialization for metadata support |
| apps/api/src/trpc/trpc.router.ts | Implemented OpenAPI generator, created /openapi.json endpoint, and added Scalar reference UI at /reference |
| apps/api/src/entities/document.entity.ts | Explicitly typed enum columns in TypeORM entity definition |
| apps/api/src/trpc/routers/*.router.ts | Added .meta() calls with tags and summaries to all tRPC procedures for documentation |
| README.md | Added API documentation section with instructions for accessing and exporting OpenAPI specs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Further comment on Trpc migration of v10 to v11. From the website, we're not using any feature impacted by the new major version, so I've decided to migrate. It's another thing for Zod v4 tho... |
|
Also, migrated to ESM module bc Orpc does not support commonjs. Honestly zod 3.25 also stopped supporting commonjs. If we did not change to ESM we'll need to use older version of at least these pacakges: Orpc, Trpc, Zod. The second two are migrated to newer version because of peer dependency warning when install Orpc and Orpc/zod. |
Issue ID/Name
Description
Checklist
Additional configuration/environment
Test result
Screenshot(s) or demo video
Reviewer
Remark